# -*- coding:utf-8 -*-
# @Time : 21-7-21 下午1:56 
# @Author : zdy
# @File : CSConfig.py
# desc:
from Class.VoltSignal import dataBase
from Class.Factor import Factor

class CSConfig(object):
    def __init__(self):
        self.name="default"
        #降炉冲洗时间
        self.timePurge=3
        # 氧枪冲洗时间
        self.timeLance=1
        # 炉室冲洗时间
        self.timeChamber=1
        self.useSensors = False
        self.switch1 = 9.5
        self.switch2 = 9.5
        self.blank1 = 0.0
        self.blank2 = 0.0
        self.waitingT = 20

        self.channels =[]
        for i in range(0,dataBase.maxChannel):
            self.channels.append(Channel(i))
        self.factors=[]
        for i in range(0,dataBase.maxChannel):
            self.factors.append(Factor())

        self.baseItems = [[] for i in range(0,dataBase.maxChannel)]
        self.multiPointItems = [[] for i in range(0, dataBase.maxChannel)]
        self.powerDelay = 20    #高频时间
        self.powerUplimit = 0  # 高频上限
        self.baselineTime = 12
        self.baselineDeviation = 30
        self.decimals = 6 #结果小数位数
        self.autoSaving = True#自动节气

class ONHConfig(object):
    def __init__(self):
        self.add =10
        self.name="default"
        self.switch1 = 9.5
        self.switch2 = 9.5
        self.switch3 = 9.5
        self.blank1 = 0.0
        self.blank2 = 0.0
        self.blank3 = 0.0

        self.channels =[]
        for i in range(0,dataBase.maxChannel):
            self.channels.append(Channel(i))
        self.factors=[]
        for i in range(0,dataBase.maxChannel):
            self.factors.append(Factor())

        self.baseItems = [[] for i in range(0,dataBase.maxChannel)]
        self.multiPointItems = [[] for i in range(0, dataBase.maxChannel)]

        self.baselineTime = 12
        self.baselineDeviation = 30

        self.powerArray = [Power(0,4500,4500,30), Power(1,4200,4200,45), Power(2,4200,4200,40)]
        self.PIDStyle = 0#0:功率调节；1：电流调节
        self.decimals = 6 #结果小数位数
        self.thermalH = False#False 红外测氢（默认），True 热导测氢


class Channel(object):
    def __init__(self,num):
        self.element=''
        self.enable=True
        self.number=num
        self.ratio=0.01
        self.comporator=20
        self.delay=3
        self.min=36
        self.max=50

class BaseCalibrationItem(object):
    def __init__(self):
        self.id =''
        self.name='1'
        self.num=0
        self.area=0.0
        self.standard=0.0
        self.calculated=0.0
        self.weight=1.0
        self.flux=0.0
        self.blank=0.0
        self.include=True
        self.input=False
        self.elementV = 0.0#保存校正时，计算出的元素绝对质量，用于曲线y轴

class MultiPointCalibrationItem(object):
    def __init__(self):
        self.id =''
        self.name='1'
        self.num=0
        self.result=0.0#根据单点矫正、基础矫正计算的结果
        self.standard=0.0
        self.calculated=0.0#多点矫正后计算结果
        self.weight=1.0
        self.flux=0.0
        self.blank=0.0
        self.include=True
        self.input=False

class Power(object):
    def __init__(self, type =0, begin = 0, end = 0 , time =0):
        self.type = type
        self.beginpower = begin
        self.endpower = end
        self.timepower = time

